Refactor mlk_polymat_permute_bitrev_to_custom#1336
Conversation
18ed177 to
28046a2
Compare
|
This proves fine in a couple of seconds for MLKEM_K=3, but spins forever for MLKEM_K=2 and MLKEM_K=4: Makes no sense to me. |
|
Since we introduced struct wrappers around mlk_polyvec and mlk_polymat, the latter is now a struct that contains a K-element array of structs, each of which contains a single K-element array of mlk_poly. This new code is trying to treat that as a single-dimensional array of K*K mlk_poly's by the look of it. That's bound to cause serious complications for CBMC. Try a nested loop, so the code structure matches the data structure. |
cc0d751 to
782e470
Compare
|
@mkannwischer Can you comment on state/plans for this? |
See pq-code-package/mldsa-native#770 - we are waiting for diffblue/cbmc#8705 to be merged. @willieyz, could you rebase this PR and also include the experimental branch of CBMC so we can confirm that the proofs pass with that version. |
Yes, I can do it. |
1745ecc to
d5b04b1
Compare
|
This seems no longer relevant; closing. @mkannwischer reopen if you disagree and foresee time to work on this. |
Why is this no longer relevant? I still want to do this refactoring as soon as the CBMC fix has been merged. |
|
Agree. We will return to this when we get a new release of CBMC. The helper function could be removed if and when CBMC can handle a nested loop efficiently. |
fe13eb9 to
4afccb7
Compare
This commit refactors mlk_polymat_permute_bitrev_to_custom to not require the helper function mlk_polyvec_permute_bitrev_to_custom. The function was only needed due CBMC limitations. The code structure now mimics the data structure to make proof tractable. Also updates Makefile for this proof in line with the similar function in mldsa-native. Signed-off-by: Matthias J. Kannwischer <matthias@kannwischer.eu> Signed-off-by: Rod Chapman <rodchap@amazon.com> Signed-off-by: willieyz <willie.zhao@chelpis.com> Re-format with clang-format and add decreases contract Signed-off-by: Rod Chapman <rodchap@amazon.com>
4afccb7 to
9f86f86
Compare
CBMC Results (ML-KEM-1024)Full Results (190 proofs)
|
CBMC Results (ML-KEM-512)Full Results (190 proofs)
|
CBMC Results (ML-KEM-768)Full Results (190 proofs)
|
mlk_polymat_permute_bitrev_to_customand prove monolithically #1375This commit refactors mlk_polymat_permute_bitrev_to_custom to not require the helper function mlk_polyvec_permute_bitrev_to_custom. The function was only needed due CBMC limitations.